<template>
	<scroll-view  class="message-list-container" scroll-y="true" :scroll-into-view="scrollView" :refresher-enabled="!isCompleted"
		@refresherrefresh="refresh" :scroll-top="scrollTop" :scroll-with-animation="scroll_animation" :refresher-triggered="triggered">
		<view id="message-scroll" style="width: 100%;">
			<view @click="lishi" v-if="messageList.length<=0" style="width: 100%;line-height: 60rpx;box-sizing: border-box;padding: 0 30rpx;overflow: hidden;background-color: #eee;font-size: 26rpx;" class="flex items-center  justify-between">
				<text style="float: left;">云端历史消息</text>
				<u-icon name="arrow-right" size="16" color="#999" style="float: right;"></u-icon>
			</view>
			<view class="no-message" v-if="isCompleted">没有更多啦</view>
			<view class="">
				<view  v-for="(item,index) in messageList" :key="index" class="t-message" >
					<view v-if="conversation.type !== '@TIM#SYSTEM'" :id="'msg'+item.time">
						<view v-if="item.type=='showTime'" style="text-align: center;font-size: 26rpx;color: #666;margin-top: 6rpx;">
							 {{ item.payload.text}}
						</view>
						<view class="t-message-item">
							<TUI-TipMessage v-if="item.type === 'TIMGroupTipElem'" :message="item"></TUI-TipMessage>
							<view v-if="item.type==='TIMCustomElem'" style="text-align: center;font-size: 26rpx;color: #666;">
								{{item.payload.description || ''}}
							</view>
							<!-- <TUI-TipMessage1 v-if="item.type === 'TIMGroupSystemNoticeElem'" :message="item"></TUI-TipMessage1> -->
							<view v-if="item.type !== 'TIMGroupTipElem' && item.type!=='TIMCustomElem'" :class="item.flow === 'out' ? 't-self-message' : 't-recieve-message'">
								<image class="t-message-avatar" v-if="item.flow === 'in'" :src="item.avatar || 'https://jw-uniapp.oss-cn-beijing.aliyuncs.com/static/images/avatar.png'"
									@click="goUser(item.from)"></image>
								<!-- <view class="read-receipts" v-if="conversation.type === 'C2C' && item.flow === 'out'">
									<view v-if="item.isPeerRead">已读</view>
									<view v-else>未读</view>
								</view> -->
								<view>
									<view v-if="item.type!='showTime' && item.flow === 'in'" style="font-size: 24rpx;color: #666;margin: 10rpx 0 10rpx;text-align: left;">
										{{item.nameCard || item.nick}}
									</view>
									<!-- <view v-if="item.type!='showTime' && item.flow === 'out'" style="font-size: 24rpx;color: #666;margin: 10rpx 0;text-align: right;">
										{{item.nameCard || item.nick}}
									</view> -->
									<TUI-TextMessage v-if="item.type === 'TIMTextElem'" :message="item"
										:isMine="item.flow === 'out'"></TUI-TextMessage>
									<TUI-ImageMessage v-if="item.type === 'TIMImageElem'" :message="item"
										:isMine="item.flow === 'out'"></TUI-ImageMessage>
									<!-- <TUI-VideoMessage v-if="item.type === 'TIMVideoFileElem'" :message="item"
										:isMine="item.flow === 'out'"></TUI-VideoMessage> -->
									<view v-if="item.type === 'TIMVideoFileElem'" :class="['video-box',item.flow === 'out' ? 'my-video' : '']" @click="playerHander(item,index)">
										  <video class="video-box-video" :src="item.payload.videoUrl" :controls='false' :show-center-play-btn='false'></video>
											<image class="video-icon" src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230527/c5ca34883fb0b05a36c562282a9d751c.png"></image>
									</view>
									<!-- <TUI-AudioMessage v-if="item.type === 'TIMSoundElem'" :message="item"
										:isMine="item.flow === 'out'"></TUI-AudioMessage> -->

									<view v-if="item.type === 'TIMSoundElem'"  :class="'audio-message ' + (item.flow === 'out' ? 'my-audio' : 'my-audio1')" @click="handlePlayAudioMessage(item,index)">
										<view v-if="item.flow === 'out'" class="audio"  :style="'width: ' + 100 + 'rpx'">
											{{ '" ' + item.payload.second }}</view>
										<image v-if="item.flow === 'out' && status!=index" class="audio-icon"
											src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230526/867371225929ecc0833b539a4306a022.png">
										</image>
										<image v-if="item.flow === 'out' && status==index" class="audio-icon"
											src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230601/5718ca19e0d7da58d99733b14c620404.gif">
										</image>
										<image v-if="item.flow === 'in' && status!=index" class="audio-icon"
											src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230526/e99417c60e3e74e313c4692a28b53847.png">
										</image>
										<image v-if="item.flow === 'in' && status==index" class="audio-icon"
											src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230601/30272adb1be32906784d6c7115482347.gif">
										</image>
										<view v-if="item.flow === 'in'" class="audio1" :style="'width: ' + 100 + 'rpx'">
											{{ item.payload.second+'" ' }}</view>

									</view>

									<TUI-CustomMessage v-if="item.type === 'TIMCustomElem'" :message="item"
										:isMine="item.flow === 'out'"></TUI-CustomMessage>
									<TUI-FaceMessage v-if="item.type === 'TIMFaceElem'" :message="item"
										:isMine="item.flow === 'out'"></TUI-FaceMessage>
									<TUI-FileMessage v-if="item.type === 'TIMFileElem'" :message="item"
										:isMine="item.flow === 'out'"></TUI-FileMessage>
								</view>
								<image class="t-message-avatar" v-if="item.flow === 'out'" :src="item.avatar || 'https://jw-uniapp.oss-cn-beijing.aliyuncs.com/static/images/avatar.png'"
									@click="goUser(item.from)"></image>
							</view>
						</view>
					</view>
					<!-- <view v-else :id="item.ID" :data-value="item.ID">
						<TUI-SystemMessage :message="item"></TUI-SystemMessage>
					</view> -->
				</view>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	import TUITextMessage from '../message-elements/text-message/index';
	import TUIImageMessage from '../message-elements/image-message/index';
	// import TUIVideoMessage from '../message-elements/video-message/index';
	// import TUIAudioMessage from '../message-elements/audio-message/index';
	import TUICustomMessage from '../message-elements/custom-message/index';
	import TUITipMessage from '../message-elements/tip-message/index';
	// import TUITipMessage1 from '../message-elements/tip-message1/index';
	import TUISystemMessage from '../message-elements/system-message/index';
	import TUIFaceMessage from '../message-elements/face-message/index';
	import TUIFileMessage from '../message-elements/file-message/index';
	const audio = uni.createInnerAudioContext();
	export default {
		data() {
			return {
				avatar: '',
				userID: '',
				// 当前会话
				messageList: [],
				// 自己的 ID 用于区分历史消息中，哪部分是自己发出的
				scrollView: '',
				scrollTop: 0,
				triggered: false,
				nextReqMessageID: '',
				// 下一条消息标志
				isCompleted: false, // 当前会话消息是否已经请求完毕
				kaiqi:true,
				status:'-1',
				 isPlay: false,
				 shifou_gun:true,
				scroll_animation:true,
				Viewid:'',
				time:''
			};
		},

		components: {
			TUITextMessage,
			TUIImageMessage,
			// TUIVideoMessage,
			// TUIAudioMessage,
			TUICustomMessage,
			TUITipMessage,
			TUISystemMessage,
			TUIFaceMessage,
			TUIFileMessage
		},
		props: {
			conversation: {
				type: Object,
				default: () => {},
			},
		},
		watch: {
			conversation: {
				handler: function(newVal) {
					if (!newVal.conversationID) return;
					this.setData({
							conversation: newVal,
						},
						() => {
							this.getMessageList(newVal);

						}
					);
				},
				immediate: true,
				deep: true,
			},
		},
		mounted() {
			this.time = new Date('2022-04-15 12:15:36').valueOf()
			console.log(this.time,787798979978978)
			uni.$TUIKit.getMyProfile().then(res => {
				console.log(res,uni.getStorageSync('userinfo').avatar)
				this.avatar = uni.getStorageSync('userinfo').avatar;
				this.userID = res.data.userID;
			});
			uni.$TUIKit.on(uni.$TUIKitEvent.MESSAGE_RECEIVED, this.$onMessageReceived, this);
			uni.$TUIKit.on(uni.$TUIKitEvent.MESSAGE_READ_BY_PEER, this.$onMessageReadByPeer, this);
		},

		destroyed() {
			this.status='-1'

			console.log(21212121212121212121)
			this.bindConfirmCreate()
			// 一定要解除相关的事件绑定
			uni.$TUIKit.off(uni.$TUIKitEvent.MESSAGE_RECEIVED, this.$onMessageReceived);
			audio.stop()

		},

		beforeMount() {
			let that=this
			audio.onPlay(() => {
				that.isplay=true
				console.log('开始播放',that.isplay);
			});
			audio.onEnded(() => {
				that.isplay=false
				console.log('停止播放');
				that.status='-1'
			});
			audio.onError(e => {
				console.error(e, 'onError');
				// ios 音频播放无声，可能是因为系统开启了静音模式
				// uni.showToast({
				// 	icon: 'none',
				// 	title: '该音频暂不支持播放',
				// });
			});
		},
		methods: {
			lishi:function(){
				if(this.conversation.type==="C2C"){
					uni.navigateTo({
						url:'/fenbao/pages/wenzhang/liaotian'
					})
				}else if(this.conversation.type==="GROUP"){
					uni.navigateTo({
						url:'/fenbao/pages/wenzhang/liaotian1'
					})
				}
			},
			// 消息变更已读
			bindConfirmCreate() {
				let that=this
			  const promise = uni.$TUIKit.setMessageRead({
			   conversationID: that.conversation.conversationID,
			  });
			  promise
			    .then(imResponse => {

			    })
			    .catch((err) => {

			    });
			},



			handlePlayAudioMessage(item,index) {
				this.status=index
				console.log(item,index)
				audio.src = item.payload.url;

				console.error(item.payload.second, 'handlePlayAudioMessage');
				audio.play();
				// console.log(item,this.isplay,123456789)
			},
			playerHander(item) {
				this.status='-1'
				audio.stop()
			  uni.$emit('videoPlayerHandler', {
			    isPlay: true,
			    message: item,
			  });
			  console.log(item);
			},
			stopHander() {
			  this.isPlay = false;
			},
			goUser(id, avatar, nick) {
				this.post('api/im/im/friend_info',{client_mobile:id},false).then(res=>{
					if(res.code==1){
						uni.navigateTo({
							url:'/fenbao/pages/wenzhang/yhxx?id='+res.data.id
						})
					}else{
									uni.showToast({
										title: res.msg,
										icon: "none",
										duration: 1000
									})
								}
				})

				// uni.navigateTo({
				// 	url: '/im/information/information?index=2&id=' + id + '&url=' + avatar + '&nick=' + nick,
				// });
			},
			// 撤回消息
			revokeMessage(item) {
				uni.$TUIKit
					.revokeMessage(item)
					.then(imResponse => {
						this.updateMessageByID(imResponse.data.message.ID);

						// 消息撤回成功
					})
					.catch(imError => {
						wx.showToast({
								title: '超过2分钟消息不支持撤回',
								duration: 800,
								icon: 'none',
							}),
							// 消息撤回失败
							console.warn('revokeMessage error:', imError);
					});
			},
			// 删除消息
			deleteMessage(item) {
				uni.$TUIKit
					.deleteMessage([item])
					.then(imResponse => {
						this.updateMessageByID(imResponse.data.messageList[0].ID);
						wx.showToast({
							title: '删除成功!',
							duration: 800,
							icon: 'none',
						});
					})
					.catch(() => {
						wx.showToast({
							title: '删除失败!',
							duration: 800,
							icon: 'error',
						});
					});
			},
			// 更新messagelist
			updateMessageByID(deleteMessageID) {
				const {
					messageList
				} = this.messageList;
				const deleteMessageArr = messageList.filter(item => item.ID === deleteMessageID);
				this.messageList = deleteMessageArr;
				console.log(this.messageList,55555555555555)
			},
			longpress(item) {
				uni.showActionSheet({
					itemList: ['撤回', '删除'],
					success: res => {
						if (res.tapIndex + 1 == 1) {
							this.revokeMessage(item);
						}
						if (res.tapIndex + 1 == 2) {
							this.deleteMessage(item);
						}
					},
					fail: function(res) {
						console.log(res.errMsg);
					},
				});
			},
			refresh() {
				let that=this
				if (this.isCompleted) {
					this.kaiqi=false
					this.setData({
						isCompleted: true,
						triggered: false,
					});
					return;
				}
				this.scroll_animation = false;//关闭滑动动画
				for(let i=0;i<this.messageList.length;i++){
					if(this.messageList[i].type!="showTime"){
						this.Viewid ='msg'+this.messageList[i].time;//记住第一个信息ID
						break
					}
				}
				console.log(this.Viewid,'loiuyuyhh')
				this.triggered=true
				this.getMessageList(this.conversation);
				// setTimeout(() => {
				// 	this.setData({
				// 		triggered: false,
				// 	});
				// }, 2000);
			},

			getMessageList(conversation) {
				let that=this
				// this.triggered=true

				console.log(conversation.conversationID,this.nextReqMessageID,1111111111)
				if (!this.isCompleted) {
					uni.$TUIKit
						.getMessageList({
							conversationID: conversation.conversationID,
							nextReqMessageID: this.nextReqMessageID,
							count: 8,
						})
						.then(res => {

							if(!this.shifou_gun){
								this.$nextTick(function() {

									that.scrollView = that.Viewid;//跳转上次的第一行信息位置

								});

							}

							this.triggered=false

							this.setData({
								triggered: false,
							});
							console.log(res.data,222222222222)
							const {
								messageList
							} = res.data; // 消息列表。

							this.nextReqMessageID = res.data.nextReqMessageID; // 用于续拉，分页续拉时需传入该字段。
							this.isCompleted = res.data.isCompleted; // 表示是否已经拉完所有消息。
							this.messageList = [...messageList, ...this.messageList];
							this.messageList=this.msgTimeFormat(this.messageList,0,0)
							console.log(this.messageList,1114447778898222)
							// this.scrollView=this.messageList[this.messageList.length-1].ID
							if(!this.shifou_gun){
								this.$nextTick(function() {

									this.scroll_animation = true;//恢复滚动动画

								});


							}
							// this.messageList.unshift(...messageList)
							// this.$handleMessageRender(this.messageList, messageList);
							if(this.shifou_gun){
								setTimeout(function(){
									that.scrollToButtom()

								},100)
								that.shifou_gun=false
							}
							console.log(that.shifou_gun,'ttttyyuuiioo')
						});
				}
			},

			// 自己的消息上屏
			updateMessageList(msg) {

				this.messageList = [...this.messageList, msg];
				this.scrollView='msg'+this.messageList[this.messageList.length-1].time
				this.scrollToButtom();
			},

			// 消息已读更新
			$onMessageReadByPeer() {
				this.setData({
					messageList: this.messageList,
				});
				console.log(this.messageList,1223445545455)
			},
			scrollToButtom() {
				const query = uni.createSelectorQuery().in(this);
				let nodesRef = query.select('#message-scroll');
				nodesRef
					.boundingClientRect(res => {
						console.log(res,'liuuuuuuuu')
						// uni.pageScrollTo({
						// 　　　　duration:2000,
						// 　　　　scrollTop:res.height
						// 　})
						this.$nextTick(() => {
							//进入页面滚动到底部
							this.scrollTop = res.height;
							console.log(this.scrollTop,123456789)
						});
					})
					.exec();


			},






			// 收到的消息
			$onMessageReceived(value) {
				// 若需修改消息，需将内存的消息复制一份，不能直接更改消息，防止修复内存消息，导致其他消息监听处发生消息错误
				const event = value;
				const list = [];
				event.data.forEach(item => {
					if (item.conversationID === this.conversation.conversationID) {
						list.push(Object.assign(item));
					}
				});
				this.messageList = this.messageList.concat(list);
				this.scrollToButtom();
				console.log(87485455555555555)
			},

			// 历史消息渲染
			$handleMessageRender(messageList) {
				let that=this
				if (messageList.length > 0) {
					this.setData({
							messageList,
						},
						() => {}
					);
					this.$nextTick(() => {
						//进入页面滚动到底部
						this.scrollTop = 9999;
					});

				}
			},








			_formatDate : function (date, fmt) {
			        var o = {
			                "M+": date.getMonth() + 1, //月份
			                "d+": date.getDate(), //日
			                "h+": date.getHours(), //小时
			                "m+": date.getMinutes(), //分
			                "s+": date.getSeconds(), //秒
			                "q+": Math.floor((date.getMonth() + 3) / 3), //季度
			                "S": date.getMilliseconds() //毫秒
			        };
			        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
			        for (var k in o)
			                if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
			                        return fmt;
			},
			_getTimeStringAutoShort2 (timestamp, mustIncludeTime){

			        // 当前时间
			        var currentDate = new Date();
			        // 目标判断时间
			        var srcDate = new Date(parseInt(timestamp));

			        var currentYear = currentDate.getFullYear();
			        var currentMonth = (currentDate.getMonth()+1);
			        var currentDateD = currentDate.getDate();

			        var srcYear = srcDate.getFullYear();
			        var srcMonth = (srcDate.getMonth()+1);
			        var srcDateD = srcDate.getDate();

			        var ret = "";

			        // 要额外显示的时间分钟
			        var timeExtraStr = (mustIncludeTime?" "+this._formatDate(srcDate, "hh:mm"):"");

			        // 当年
			        if(currentYear == srcYear) {
			                var currentTimestamp = currentDate.getTime();
			                var srcTimestamp = timestamp;
			                // 相差时间（单位：毫秒）
			                var deltaTime = (currentTimestamp-srcTimestamp);

			                // 当天（月份和日期一致才是）
			                if(currentMonth == srcMonth && currentDateD == srcDateD) {
			                // 时间相差60秒以内
			                if(deltaTime < 60 * 1000)
			                        ret = "刚刚";
			                // 否则当天其它时间段的，直接显示“时:分”的形式
			                else
			                        ret = this._formatDate(srcDate, "hh:mm");
			                }
			                // 当年 && 当天之外的时间（即昨天及以前的时间）
			                else {
			                        // 昨天（以“现在”的时候为基准-1天）
			                        var yesterdayDate = new Date();
			                        yesterdayDate.setDate(yesterdayDate.getDate()-1);

			                        // 前天（以“现在”的时候为基准-2天）
			                        var beforeYesterdayDate = new Date();
			                        beforeYesterdayDate.setDate(beforeYesterdayDate.getDate()-2);

			                        // 用目标日期的“月”和“天”跟上方计算出来的“昨天”进行比较，是最为准确的（如果用时间戳差值
			                        // 的形式，是不准确的，比如：现在时刻是2019年02月22日1:00、而srcDate是2019年02月21日23:00，
			                        // 这两者间只相差2小时，直接用“deltaTime/(3600 * 1000)” > 24小时来判断是否昨天，就完全是扯蛋的逻辑了）
			                        if(srcMonth == (yesterdayDate.getMonth()+1) && srcDateD == yesterdayDate.getDate())
			                                ret = "昨天"+timeExtraStr;// -1d
			                        // “前天”判断逻辑同上
			                        else if(srcMonth == (beforeYesterdayDate.getMonth()+1) && srcDateD == beforeYesterdayDate.getDate())
			                                ret = "前天"+timeExtraStr;// -2d
			                        else{
			                                // 跟当前时间相差的小时数
			                                var deltaHour = (deltaTime/(3600 * 1000));

			                                // 如果小于或等 7*24小时就显示星期几
			                                if (deltaHour <= 7*24){
			                                var weekday=new Array(7);
			                                weekday[0]="星期日";
			                                weekday[1]="星期一";
			                                weekday[2]="星期二";
			                                weekday[3]="星期三";
			                                weekday[4]="星期四";
			                                weekday[5]="星期五";
			                                weekday[6]="星期六";

			                                // 取出当前是星期几
			                                var weedayDesc = weekday[srcDate.getDay()];
			                                ret = weedayDesc+timeExtraStr;
			                                }
			                                // 否则直接显示完整日期时间
			                                else
			                                ret = this._formatDate(srcDate, "yyyy/M/d")+timeExtraStr;
			                        }
			                }
			        }
			        // 往年
			        else{
			                ret = this._formatDate(srcDate, "yyyy/M/d")+timeExtraStr;
			        }

			        return ret;
			},
			msgTimeFormat(currentMessageList, sort, type) {
			    // console.log('传入的会话数组', currentMessageList)
			    const newMessageList = []
			    const currentFilterList = currentMessageList.filter((item) => {
			        return item.type !== 'showTime'
			    })
			    currentFilterList.forEach((item, index) => {
			        const date = item.time * 1000
			        let showTime
			        if (index === 0) {
			        //第一条必显示时间
			            showTime = this._getTimeStringAutoShort2(date, true)
			            newMessageList.push({
			                payload: {
			                    text: showTime
			                },
			                type: 'showTime',//超五分钟显示时间-标识
			                time: item.time
			            })
			            newMessageList.push(item)
			        } else if (index <= currentFilterList.length - 1) {
			            const current = currentFilterList[index].time
			            let minutes
			            const showTimeList = newMessageList.filter((item) => {
			                return item.type === 'showTime'
			            })
			            const lastShowTime = showTimeList[showTimeList.length - 1].time//添加的时间且最后一条，用于对比
			            if (type) {
			                const prev = currentFilterList[index - 1].time
			                minutes = (current - prev) / 60
			            }
			            if (!sort) {
			                minutes = (current - lastShowTime) / 60
			            } else {
			                minutes = (lastShowTime - current) / 60
			            }
			            //超五分
			            if (minutes > 5) {
			                showTime = this._getTimeStringAutoShort2(date,  true)
			                newMessageList.push({
			                    payload: {
			                        text: showTime
			                    },
			                    type: 'showTime',
			                    time: item.time
			                })
			                newMessageList.push(item)
			            } else {
			                newMessageList.push(item)
			            }
			        }
			    })
			    // console.log('最后得到的数组', newMessageList)
			    return newMessageList
			},


		},
		filters: {
			showTimePipe:function(unix_stamp) { // unix_stamp 精确到微秒
			      var _today_obj = new Date(),
			          _today_date = {
			            y : _today_obj.getFullYear(),
			            m : ( _today_obj.getMonth() + 1 < 10 ? '0' + ( _today_obj.getMonth() - - 1 ) : (_today_obj.getMonth() - - 1) ),
			            d : ( _today_obj.getDate() < 10 ? '0' + _today_obj.getDate() : _today_obj.getDate() )
			         }

			     var _today_stamp = Date.parse(_today_date.y + '/' + _today_date.m + '/' + _today_date.d + ' 00:00:00')

			     var stamp = []
			     stamp[0] = _today_stamp + 86400000
			     stamp[1] = _today_stamp
			     stamp[2] = _today_stamp - 86400000
			     stamp[3] = _today_stamp - 172800000

			     stamp[4] = _today_stamp - 518400000 // 7天

			     stamp[5] = _today_stamp - 31536000000 // 365天

			     var _compare_obj = new Date()
			     _compare_obj.setTime(unix_stamp)

			     var return_str

			     if (unix_stamp >= stamp[1] && unix_stamp < stamp[0]) {
			       return_str = _compare_obj.getHours() + ':' +  ( _compare_obj.getMinutes() < 10 ? '0' + _compare_obj.getMinutes() : _compare_obj.getMinutes() )
			     } else if (unix_stamp >= stamp[2] && unix_stamp < stamp[1]) {
			       var yesterdayText = '昨天'
			       return_str = yesterdayText  + ' ' + _compare_obj.getHours() + ':' +
			         ( _compare_obj.getMinutes() < 10 ? '0' + _compare_obj.getMinutes() : _compare_obj.getMinutes() )
			     } else if (unix_stamp >= stamp[3] && unix_stamp < stamp[2]) {
			       var theDayBeforeYesterdayText = '前天'
			      return_str = theDayBeforeYesterdayText  +  ' ' + _compare_obj.getHours() + ':' +
			         ( _compare_obj.getMinutes() < 10 ? '0' + _compare_obj.getMinutes() : _compare_obj.getMinutes() )

			     } else if (unix_stamp >= stamp[4] && unix_stamp < stamp[3]) { // 7天内
			       var daynames = ['天', '一', '二', '三', '四', '五', '六']
			       var dathStr = '星期' + daynames[_compare_obj.getDay()]

			       var SundayText = '星期天'
			       var MondayText = '星期一'
			       var TuesdayText = '星期二'
			       var WednesdayText = '星期三'
			       var ThursdayText = '星期四'
			       var FridayText = '星期五'
			       var SaturdayText = '星期六'

			       var dathStr2

			       switch (dathStr) {
			         case '星期天':
			           dathStr2 = SundayText
			           break
			         case '星期一':
			           dathStr2 = MondayText
			           break
			         case '星期二':
			           dathStr2 = TuesdayText
			           break
			         case '星期三':
			           dathStr2 = WednesdayText
			          break
			         case '星期四':
			           dathStr2 = ThursdayText
			           break
			         case '星期五':
			           dathStr2 = FridayText
			           break
			         case '星期六':
		               dathStr2 = SaturdayText
			           break
			         default:
			           dathStr2 = dathStr
			           break
			       }

			       return_str = dathStr2 + ' ' + _compare_obj.getHours() + ':' +
			         ( _compare_obj.getMinutes() < 10 ? '0' + _compare_obj.getMinutes() : _compare_obj.getMinutes() )
			     } else if (unix_stamp >= stamp[5] && unix_stamp < stamp[4]) { // 365天内
			         var monthText = '月'
			        var dayText = '日'
			         return_str = (_compare_obj.getMonth() - (-1)) + monthText + _compare_obj.getDate() + dayText + ' '
			           + _compare_obj.getHours() + ':' +  ( _compare_obj.getMinutes() < 10 ? '0' + _compare_obj.getMinutes() : _compare_obj.getMinutes() )

			     } else {
			       var yearText = '年'
			       var monthText = '月'
			       var dayText = '日'
			       return_str = _compare_obj.getFullYear() + yearText + (_compare_obj.getMonth() - (-1)) +
			         monthText + _compare_obj.getDate() + dayText + ' ' + _compare_obj.getHours() + ':' +
			         ( _compare_obj.getMinutes() < 10 ? '0' + _compare_obj.getMinutes() : _compare_obj.getMinutes() )
			     }
			    return return_str

			   }
		},
	};
</script>
<style>
	@import './index.css';
	@import './index1.css';
	@import './index2.css';
</style>